package com.lvmama.rhino.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lvmama.rhino.entity.DeviceNotificationStatisticVO;
import com.lvmama.rhino.mapperHippo.DeviceNotificationStatisticMapper;
import com.lvmama.rhino.pojo.DeviceNotificationStatistic;
import com.lvmama.rhino.service.DeviceNotificationStatisticService;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @author wuchuantong
 * @version V1.0
 * @Title: DeviceNotificationStatisticServiceImpl
 * @Package com.lvmama.rhino.service.impl
 * @Description: 设备通知开关情况统计服务实现类
 * @date 2017/3/6 14:05
 */
@Service
public class DeviceNotificationStatisticServiceImpl implements DeviceNotificationStatisticService {

    protected Logger logger = Logger.getLogger(this.getClass());

    @Autowired
    private DeviceNotificationStatisticMapper deviceNotificationStatisticMapper;

    @Override
    public PageInfo<DeviceNotificationStatistic> getDeviceNotificationStatisticListPage(DeviceNotificationStatisticVO statisticVO) {
        PageHelper.startPage(statisticVO.getPage(), statisticVO.getPageSize());
        List<DeviceNotificationStatistic> messages = deviceNotificationStatisticMapper.getDeviceNotificationStatisticListPage(statisticVO);
        PageInfo<DeviceNotificationStatistic> page = new PageInfo<>(messages);
        //校验日期格式
        return page;
    }

    @Override
    public PageInfo<Map<String, Object>> getListMapPage(DeviceNotificationStatisticVO statisticVO) {
        PageHelper.startPage(statisticVO.getPage(), statisticVO.getPageSize());
        List<Map<String, Object>> messages = deviceNotificationStatisticMapper.getListMapPage(statisticVO);
        PageInfo<Map<String, Object>> page = new PageInfo<>(messages);
        //校验日期格式
        return page;
    }
}
